//
//  BuilderObject.m
//  TestBuilder
//
//  Created by Aimy on 4/14/15.
//  Copyright (c) 2015 aimy. All rights reserved.
//

#import "BuilderObject.h"

@interface BuilderObject ()

@property (nonatomic, strong) NSNumber *type;

@end

@implementation BuilderObject

+ (instancetype)createWithMaker:(void (^)(ObjectMaker *maker))block
{
    ObjectMaker *maker = ObjectMaker.new;
    
    if (block) {
        block(maker);
    }
    
    return [self createWithObjectMaker:maker];
}

+ (instancetype)createWithObjectMaker:(ObjectMaker *)maker
{
    BuilderObject *bo = [self alloc];
    
    if ([maker.type isEqual: @1]) {
        bo = [bo init];
    }
    else {
        bo = [bo init2];
    }
    
    bo.type = maker.type;
    return bo;
}

- (instancetype)init2
{
    self = [super init];
    return self;
}

@end
